<template>
  <div class="enroll">
    <div class="land">
        <p style="font-size:30px;margin-bottom: 40px;">注册</p>
        <input type="text" placeholder="输入手机号/用户名" v-model="from.phone"> <br>
        <input type="password" placeholder="输入密码" v-model="from.pass">
        <input type="password" placeholder="确认密码">
        <p style="text-align: right; font-size:20px;" @click="gets">去登陆</p>
        <input type="button" value="注册" style="background-color:	#00BFFF ;" @click="enrolls">
    </div>
  </div>
</template>

<script>
import { user_register } from "../api/api";
export default {
name:'enroll',
data(){
  return{
    list:[],
    from:{phone:'',pass:''}
  }
},
 methods:{
   gets(){
    this.$router.push('/landing')
   },
   enrolls(){
    user_register({phone:this.from.phone,pass:this.from.pass}).then((res)=>{
      if(res.data.code==200){
        alert('注册成功')
        this.$router.push('/landing')
      }else{
        alert('该账号已注册请重新注册')
      }
         
         
    })
   }
 },

}
</script>

<style scoped>
.landing{
    margin: auto;
    text-align: center;
}
.land{
    width: 310px;
    height: 100%;
    margin: 130px auto;
    text-align: center;
    
}
input{
    width: 300px;
    height: 40px;
    margin-bottom: 10px;
    border-radius:40px ;
    text-align: center;
    font-size: 20px;
}

</style>